import sys
import datetime
from tools_pmc import today_str4, yesterday_str3


def tdl_time():
    file = open(r"\\192.168.70.101\19计划管理部\01.计划\1，数据处理工具\file\config\time.txt", 'w')
    file.write(today_str4)
    return today_str4


def kcmxz_time_start():
    file = open(r"\\192.168.70.101\19计划管理部\01.计划\1，数据处理工具\file\config\time.txt", 'w')
    file.write(yesterday_str3)
    return yesterday_str3


def kcmxz_time_stop():
    today = datetime.date.today()
    yesterday2 = today - datetime.timedelta(days=1)
    yesterday2_str = yesterday2.strftime("%Y%m%d")
    file = open(r"\\192.168.70.101\19计划管理部\01.计划\1，数据处理工具\file\config\time.txt", 'w')
    file.write(yesterday2_str)
    return yesterday2_str


print(sys.argv)
if len(sys.argv) == 1:
    print(tdl_time(), kcmxz_time_start(), kcmxz_time_stop())
elif sys.argv[1] == "tdl_time":
    tdl_time()
elif sys.argv[1] == "kcmxz_time_start":
    kcmxz_time_start()
elif sys.argv[1] == "kcmxz_time_stop":
    kcmxz_time_stop()

